package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.LogMapper;
import com.itheima.pojo.LogPageQueryVO;
import com.itheima.pojo.OperateLog;
import com.itheima.result.PageResult;
import com.itheima.service.LogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class LogServiceimpl implements LogService {


    private final LogMapper logMapper;

    /**
     * 分页查询日志
     * @param page
     * @param pageSize
     * @return
     */
    @Override
    public PageResult PageQuery(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        Page<LogPageQueryVO> operateLogs = logMapper.selectPage();
        return new PageResult(operateLogs.getTotal(),operateLogs.getResult());
    }
}
